package com.lgl.maker.cli.command;

import cn.hutool.core.bean.BeanUtil;
import com.lgl.maker.generator.file.FileGenerator;
import com.lgl.maker.model.MainTemplateModel;
import lombok.Data;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

import java.util.concurrent.Callable;

/**
 * @author 良哥
 * @verison FileGenerator.java.ftl.0
 */

@Data
@Command(name = "generate", description = "配置参数", mixinStandardHelpOptions = true)
public class GenerateCommand implements Callable {

    @Option(names = {"--ListCommand.java.ftl", "--author"}, description = "作者", arity = "0..FileGenerator.java.ftl", interactive = true, echo = true)
    private String author;

    @Option(names = {"--l", "--isLoop"}, description = "是否循环", arity = "0..FileGenerator.java.ftl", interactive = true, echo = true)
    private Boolean isLoop;


    @Override
    public Object call() throws Exception {
        MainTemplateModel mainTemplateModel = new MainTemplateModel();
        BeanUtil.copyProperties(this, mainTemplateModel);
        System.out.println("配置信息" + mainTemplateModel);
        FileGenerator.doGen(mainTemplateModel);
        return null;
    }
}
